This readme file guides you through generating the tables and figures from the paper
"Skill-Biased Technological Change and the Business Cycle" by Almut Balleer and Thijs van Rens
October 2013
--------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------

zip-file skillbias.zip
Extract all files into a folder. Several subfolders will be generated.
Add matlab folders to your Matlab path. Note that you need the statistics and econometrics toolbox for matlab in order to run the files!
Open Stata files from the folder they are in so that the current directory will be set to this folder.

--------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------
Business Cycle moments
--------------------------------------------------------------------------------------------------
To replicate the entries in Table 1, run the Stata file cyclical properties.do (in the folder stata_results)

--------------------------------------------------------------------------------------------------
Production function decomposition:
--------------------------------------------------------------------------------------------------
To replicate the first two rows from Figure 1, run plots_prodfunction_pub.m (in the folder matlab_SVARresults)
To generate the data used in this code, run irfs_2nd_revision (in the folder stata_results)

--------------------------------------------------------------------------------------------------
SVAR results:
--------------------------------------------------------------------------------------------------
The main file to run is skillbias_main_pub.m (in folder matlab_SVARresults)
In this file, you can choose various options in the beginning that are related to the different specifications in the paper.
You should not need to change any code below line 105

For the baseline specification, the following options should be set
prem_choice = 1
prod_choice = 0
price_choice = 0
hours_choice = 3
sample = 2
do_level = 0
do_break = 0
break_choice = 0
prior = 1
nlagsvar = 8
ndraws = 1000 (see comments below)
decay = 3
do_vardecomp = 0

Notes:
median responses and confidence bands vary, due to different draws in each run of the prorgams.
Hence, they should be very close, but not necessarily identical to the results
shown in the paper
for specifications that use sign restrictions, the code takes a while to run depending on your computer. 
Set ndraws = 100 and maxdraws=10 (in the end, these should be set to... XXX)

--------------------------------------------------------------------------------------------------
1. SBT identification using long-run zero restrictions
Generates row 3 and 4 of Figure 1.
in addition to the above, set the following options:
spec = 6
do_sign = 0

Remark: The hours response after SBT+UBT shocks will appear slightly different than in the paper. 
The reason is a small timing mistake in the data that was corrected after acceptance of the paper. 
This does not change the conclusions drawn in the paper with respect to this response, however.

--------------------------------------------------------------------------------------------------
2. SBT identification using long-run zero and sign restrictions
Generates rows 1 and 2 of Figure 2.
in addition to the above, set the following options:
spec = 9
do_sign = 1

--------------------------------------------------------------------------------------------------
3. SBT identification with supply shocks
Generates rows 3-5 of Figure 2 and row 2 of Figure 3 and Table 2.
in addition to the above, set the following options:
spec = 25
do_sign = 2
For Table 2, set do_vardecomp = 1

The variance decomposition shows blocks of decompositions for each variable. These do not appear exactly in the same order as in the paper!
In these matrices, the columns correpond to horizons 1 (1-2), 8 (3-4), 16 (5-6) and 32 (7-8).
The rows correspond to supply shocks (1-2), SBT shocks (3-4), other T shocks (5-6) and residual shocks (7-8).
The first row for each type of shock shows the median, the second row the confidence bands.

To generate the first row of Figure 3, change from spec = 25 to spec = 26 and set do_vardecomp = 0.

Remark: 
The response of hours high and wage low after SBT shocks in Figure 3 will appear slightly different than in the paper. 
The reason is a small timing mistake in the data that was corrected after acceptance of the paper. 
This does not change the conclusions drawn in the paper with respect to this response, however.
In the paper, there is a typo in Table 2, upper confidence value for supply shocks on output in horizon 8, this should be 45.11 instead of 6.8.

--------------------------------------------------------------------------------------------------
4. IBT identification
Generates Figure 4
in addition to the above, set the following options:
spec = 5
do_sign = 0

--------------------------------------------------------------------------------------------------
5. IBT, SBT, other T and supply shocks
Generates Figure 7 and Table 4
in addition to the above, set the following options:
spec = 32
do_sign = 2
For Table 4, set do_vardecomp = 1

The variance decomposition shows blocks of decompositions for each variable. These do not appear exactly in the same order as in the paper!
In these matrices, the columns correpond to horizons 1 (1-2), 8 (3-4), 16 (5-6) and 32 (7-8).
The rows correspond to IBT shocks (1-2), supply shocks (3-4), SBT shocks (5-6), other T shocks (7-8) and residual shocks (9-10).
The first row for each type of shock shows the median, the second row the confidence bands.

--------------------------------------------------------------------------------------------------
6. Robustness
In order to generate Table 3, set the following options
baseline without supply shocks: spec = 9, do_sign = 1
baseline with supply shocks: spec = 25, do_sign = 2
for the consecutive rows, keep spec = 25 and do_sign = 2 and change the following respectively
dummy trend: do_break = 1, break_choice = 0
low-pass trend: do_break = 1, break_choice = 2
polynomial trend: do_break = 1, break_choice = 31 (or 32, 33 alternatively)
hours in levels: hours_levels = 1
subsample: sample = 1
2 lags: nlagsvar = 2
4 lags: nlagsvar = 4
12 lags: nlagsvar = 12
weaker prior: decay = 1
flat prior, 2 lags: prior = 2, nlagsvar = 2
flat prior 4 lags: prior = 2, nlagsvar = 4
CPS hours: hours_choice = 1
total hours: hours_choice = 0
naive wage premium: prem_choice = 2
adding investment price: spec = 28
adding investment: spec = 29
adding consumption: spec = 30
adding interest rate : spec = 31


--------------------------------------------------------------------------------------------------
Results from the model simulation
--------------------------------------------------------------------------------------------------
To replicate Figures 5 and 6, run plots_sim_pub.m (in folder matlab_SVARresults)
In order to get the inputs for this file
- run the SVAR with spec = 5 as described above
- run skillbias_sim.m (in folder matlab_SVARresults) to get the impulse responses estimated from model simulated data
- run RED1.m (in folder matlab_model_simul) to simulate the model, save the theoretical irfs and simulated data to estimate the VAR on (copy output file VARdata.mat to folder matlab_SVARresults)


